// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1

MyPage {
    id: aboutPage


    ToolBar {
        id: toolBar
        ToolButton {
            id: toolBarButtonDialog
            icon: "qrc:/qml/images/bar_roster.png"
            anchors.left: parent.left
            anchors.leftMargin: 30
            onClicked: {
                aboutPage.closePage( "qrc:/qml/RosterPage.qml" )
            }
            pauseAnim: 500
        }
    }

    /**-----------------------------**/

    onVisibleChanged: {
        if( visible ) {
            animImage.running = true
        }
    }

    ParallelAnimation {
        id: animImage
        running: false
        NumberAnimation { target: imgAbout; property: "scale"; from: 10; to: 1; duration: 600 }
        NumberAnimation { target: imgAbout; property: "opacity"; from: 0; to: 1; duration: 1200 }
    }

    Item {
        id: mainPane
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.top: parent.top
        anchors.bottom: toolBar.top
        anchors.leftMargin: 12
        anchors.rightMargin: 12
        anchors.topMargin: 12
        anchors.bottomMargin: 12

        Item {
            id: img_about

            anchors.top: parent.top
            anchors.left: parent.feft
            width: screen.orientationString == "Landscape" || screen.orientationString == "LandscapeInverted" ? parent.width/2 : parent.width
            height: screen.orientationString == "Landscape" || screen.orientationString == "LandscapeInverted" ? parent.height : parent.height/2

            Image {
                id: imgAbout
                source: "qrc:/meegim80.png"

                width: 120
                height: 120

                anchors.horizontalCenter: parent.horizontalCenter
                anchors.top: parent.top
                anchors.topMargin: 60
                smooth: true
                fillMode: Image.PreserveAspectFit
            }

            Text {
                id: lblQnetMan
                anchors.top: imgAbout.bottom
                anchors.topMargin: 30
                anchors.horizontalCenter: parent.horizontalCenter
                text: "MeegIM";
                font.pixelSize: 40
                font.bold: true
                color: "blue"
            }
        }

        //------------------

        Item {
            id: textAbout
            width: screen.orientationString == "Landscape" || screen.orientationString == "LandscapeInverted" ? parent.width/2 : parent.width
            height: screen.orientationString == "Landscape" || screen.orientationString == "LandscapeInverted" ? parent.height : parent.height/2

            anchors.top: screen.orientationString == "Landscape" || screen.orientationString == "LandscapeInverted" ? parent.top : img_about.bottom
            anchors.bottom: parent.bottom
            anchors.left: screen.orientationString == "Landscape" || screen.orientationString == "LandscapeInverted" ? img_about.right : parent.left

            anchors.topMargin: screen.orientationString == "Landscape" || screen.orientationString == "LandscapeInverted" ? 0 : -80
            //anchors.bottomMargin: screen.orientationString == "Landscape" || screen.orientationString == "LandscapeInverted" ? 0 : -50

            anchors.leftMargin: screen.orientationString == "Landscape" || screen.orientationString == "LandscapeInverted" ? -10 : 10
            anchors.rightMargin:  screen.orientationString == "Landscape" || screen.orientationString == "LandscapeInverted" ? -20 : 10


            Flickable {
                id: flickAboutText
                anchors.top: parent.top
                anchors.topMargin: 5
                anchors.bottom: parent.bottom
                anchors.bottomMargin: 5
                contentHeight: colAboutText.height
                contentWidth: colAboutText.width
                flickableDirection: Flickable.VerticalFlick
                height: textAbout.height
                width: textAbout.width
                clip: true

                Column {
                    id: colAboutText
                    spacing: 20
                    Text { font.pixelSize: 22; text: "<b>" + qsTr("Version") +":</b> "+ xmppClient.version }
                    Text { font.pixelSize: 22; text: "<b>" + qsTr("Author") + ":</b> " + qsTr("Anatoly Kozlov") }
                    Text { font.pixelSize: 22; text: "<b>" + qsTr("Licence")+":</b>" }
                    Text { font.pixelSize: 22; text: qsTr("GPL v3") }
                    Text { font.pixelSize: 22; text: "<a href='http://www.gnu.org/licenses/gpl.html'>http://www.gnu.org/licenses/gpl.html</a>"; onLinkActivated: { Qt.openUrlExternally (link) } }
                    Text { font.pixelSize: 22; text: qsTr("MeegIM is a simple XMPP client. \nIt is written in QML/C++ and uses \nthe Qt framework.") }
                    Text { font.pixelSize: 22; text: qsTr("This application is open source.\nSource code and other details \non the web-page of the project:") }
                    Text { /*anchors.horizontalCenter: parent.horizontalCenter;*/ font.pixelSize: 22; text: "<a href='http://code.google.com/p/meegim'>http://code.google.com/p/meegim</a><br/>"; onLinkActivated: { Qt.openUrlExternally (link) } }
                    Text { text: "\n" }
                    Text { font.pixelSize: 22; text: qsTr("Based on:") }
                    Text { font.pixelSize: 22; text: qsTr("* Qxmpp:") }
                    Text { font.pixelSize: 22; text: "<a href='http://code.google.com/p/qxmpp/'>http://code.google.com/p/qxmpp/</a>"; onLinkActivated: { Qt.openUrlExternally (link) } }
                    Text { font.pixelSize: 22; text: qsTr("* Faenza icons:") }
                    Text { font.pixelSize: 20; text: "<a href='http://code.google.com/p/faenza-icon-theme/'>http://code.google.com/p/faenza-icon-theme/</a>"; onLinkActivated: { Qt.openUrlExternally (link) } }
                    Text { text: "\n" }
                    Row {
                        anchors.horizontalCenter: parent.horizontalCenter
                        spacing: 6
                        Image { height: 36; width: height; smooth: true; anchors.verticalCenter: parent.verticalCenter; source: "qrc:/qml/images/twitter.png" }
                        Text { anchors.verticalCenter: parent.verticalCenter; font.pixelSize: 24; text: "<a href='http://twitter.com/anatolyk82'>Twitter</a> #meegim<br/>"; onLinkActivated: { Qt.openUrlExternally (link) } }
                    }
                }

            } //Flickable

        } //Column
    } //Item

}
